/*
	Copyright 2007-2010 Petr Ohlidal

	This file is a part of GrobMaker

	GrobMaker is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	GrobMaker is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with GrobMaker.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef GROBMAKER_RECTANGLE
#define GROBMAKER_RECTANGLE

/** @file */

#include "Vector.hpp"
#include <ostream>

namespace GrobMaker{

struct Rectangle{
	int x,y,w,h;

	Rectangle(int x_, int y_, int w_, int h_)
		:x(x_), y(y_), w(w_), h(h_){}

	Rectangle()
		:x(0), y(0), w(0), h(0){}

	Vector getCenter() const{
		return Vector(
			static_cast<float>(x)+static_cast<float>(w)/2,
			static_cast<float>(y)+static_cast<float>(h)/2);
	}
};

std::ostream& operator<<(std::ostream& o, const Rectangle& r);

} // namespace GrobMaker

#endif //#ifndef GROBMAKER_RECTANGLE
